//
// System.Runtime.Serialization.Formatter.cs
//
// Duncan Mak  (duncan@ximian.com)
//
// (C) Ximian, Inc.
//

//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#ifndef FormatterConverter_h
#define FormatterConverter_h

#include <CSharpPropertyMethods.h>
#include <System/EventArgs.h>
#include <System/NotImplementedException.h>
#include <System/Runtime/Serialization/IFormatterConverter.h>
#include <System/Convert.h>

namespace Riccsson
{
	namespace System
	{
		namespace Runtime
		{
			namespace Serialization
			{
				class FormatterConverter : public IFormatterConverter
				{
					public: FormatterConverter ()
					{
					}

					public: GC_PTR<object> Convert (object* value, Type* type)
					{
						//return System::Convert::ChangeType (value, type);
						throw;
					}

					public: GC_PTR<object> Convert (object* value, TypeCode* typeCode)
					{
						//return System::Convert::ChangeType (value, typeCode);
						throw;
					}

					public: bool ToBoolean (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");
		
						return System::Convert::ToBoolean (value);
					}

					public: byte ToByte (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToByte (value);
					}

					public: char ToChar (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToChar (value);
					}

					public: DateTime ToDateTime (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return **System::Convert::ToDateTime (value);
					}

					public: decimal ToDecimal (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToDecimal (value);
					}

					public: double ToDouble (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToDouble (value);
					}

					public: short ToInt16 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToInt16 (value);
					}

					public: int ToInt32 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToInt32 (value);
					}

					public: long long ToInt64 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToInt64 (value);
					}

					public: float ToSingle (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToSingle (value);
					}

					public: GC_PTR<string> ToString (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToString (value);
					}

					public: sbyte ToSByte (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToSByte (value);
					}

					public: ushort ToUInt16 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToUInt16 (value);
					}

					public: uint ToUInt32 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToUInt32 (value);
					}

					public: ulong ToUInt64 (object* value)
					{
						if (value == null)
							throw ArgumentNullException ("value is null.");

						return System::Convert::ToUInt64 (value);
					}
				};
			}
		}
	}
}

#endif